package com.jdbcUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class test1 {

	public static void main(String[] args) throws SQLException {
		jdbcUtil jd = new jdbcUtil();
		Connection conn = jd.getConnection();
	/*	String sql = "select * from cgw_t_login where username='admin'-- '' and password = '1w23' ";
		StatementUtil su = new StatementUtil();
		Statement sm = su.getStatement(conn);
		ResultsetUtil ru = new ResultsetUtil();
		ResultSet rs = ru.getResult(sm, sql);
		if(rs.next()){
			System.out.println(rs.getString(2));
		}else{
			System.out.println("登录失败");
		}
		*/
		String sql = "select * from cgw_t_login where username=? and password = ? ";
		PreparedStatementUtil pu = new PreparedStatementUtil();
		PreparedStatement psm = pu.getPreparedStatemen(conn, sql);
		psm.setString(1, "admin'-- '");
		psm.setString(2, "1323");
		ResultsetUtil ru = new ResultsetUtil();
		ResultSet rs = ru.getResult(psm);
		if(rs.next()){
			System.out.println(rs.getString(2));
		}else{
			System.out.println("登录失败");
		}
		  rs.close();
		  psm.close();
		  conn.close();
	}

	
	
	
	
	
}
